<script setup lang="ts">
import {useCounterStore} from './stores/count'
import {storeToRefs} from 'pinia'
// 函数式编程 想要用 store的数据就得调用函数
const store = useCounterStore()
const {count, doubleCount} = storeToRefs(store)
</script>

<template>
  app
  <p>{{count}}</p>
  <p>{{doubleCount}}</p>
  <button @click="store.update">同步count++</button>
  <button @click="store.asyncUpdate">异步count++</button>
</template>

<style lang="scss" scoped></style>
